# 字典 Dictionary 🏀

print("---------------len--------------------")
# len() 求长度 🏀
dict1 = {"name": "leslie", "age": 19, "height": 1.8}
print(len(dict1))  # 3

print("-------------keys----------------------")
# keys() 返回 keys 🏀
print(dict1.keys())  # dict_keys(['name', 'age', 'height'])
print(type(dict1.keys()))  # <class 'dict_keys'>
for i in dict1.keys():  # 遍历 keys
    print(i)

print("-------------values----------------------")
# values() 返回 values 🏀
print(dict1.values())  # dict_values(['leslie', 19, 1.8])
print(type(dict1.values()))  # <class 'dict_values'>
for v in dict1.values():
    print(v)

print("-------------items----------------------")
# items() 返回 items 🏀
print(dict1.items())  # dict_items([('name', 'leslie'), ('age', 19), ('height', 1.8)])
print(type(dict1.items()))  # <class 'dict_items'>
for item in dict1.items():
    print(item)
    print(item[0])
    print(item[1])
    print(type(item))  # <class 'tuple'>

# 使用场景: 描述物体
